package cn.itcast.bos.repository;


import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.bos.domain.base.Courier;
/**
 * JpaRepository<Courier, Integer>
 * 第一个参数是实体类
 * 第二个参数是实体类主键的数据类型
 * @author Administrator
 *
 */
public interface CourierRepository extends JpaRepository<Courier, Integer>,JpaSpecificationExecutor<Courier> {

	@Query("update Courier set deltag = '1' where id = ?")
	@Modifying
	void updateDelTag(Integer id);

	@Query("update Courier set deltag =null where id = ?")
	@Modifying
	void backDelTag(Integer id);

	@Query("from Courier c inner join fetch c.fixedAreas f where f.id = ?")
	List<Courier> findAssociationCourier(String fixedAreaId);

}
